﻿@model RiverCruise.Models.CompanyManagement.EditCompanyModel
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "Edit Company";
}

<div class="container-fluid">
    <h2>Edit @Model.Name</h2>
    <hr/>

    @using (Html.BeginForm("Edit", "CompanyManagement", FormMethod.Post, new { @class = "form-horizontal" }))
    {
        @Html.AntiForgeryToken()
        @Html.HiddenFor(model => model.Id)

        if (!ViewData.ModelState.IsValid)
        {
            <div class="bs-callout bs-callout-danger text-danger ">
                @Html.ValidationSummary()
            </div>
        }

        if (Model.CompanyModified)
        {
            <div class="bs-callout bs-callout-succes text-success ">
                <ul>
                    <li>Company updated</li>
                </ul>
            </div>
        }

        <div class="form-group">
            @Html.LabelFor(model => model.Name, new { @class = "col-sm-2 control-label" })
            <div class="col-sm-10">
                @Html.TextBoxFor(model => model.Name, new { @class = "form-control", placeholder = "Name" })
                <span class="text-danger">@Html.ValidationMessageFor(model => model.Name)</span>
            </div>
        </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Website, new { @class = "col-sm-2 control-label" })
        <div class="col-sm-10">
            @Html.TextBoxFor(model => model.Website, new { @class = "form-control", placeholder = "Website" })
            <span class="text-danger">@Html.ValidationMessageFor(model => model.Website)</span>
        </div>
    </div>

        <br />
        <div class="form-group">
            <div class="col-sm-2 ">
                <span>@Html.ActionLink("Back to detail", "Detail", "Company", new { Id = Model.Id }, new { @class = "btn btn-block btn-warning" })</span>
            </div>
            <div class="col-sm-10">
                <button type="submit" class="btn btn-primary form-control">Edit</button>
            </div>
        </div>
    }

</div>

